<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('内外向交货单原始数据列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>交货：</label>
                                <input type="text" name="VBELN" id="VBELN"style="width: 130px;"/>
                            </li>

                            <li>
                                <label>供应商：</label>
                                <input type="text" name="LIFNR" style="width: 130px;"/>
                            </li>
                            <li>
                                <label>交货项目：</label>
                                <input type="text" name="POSNR" style="width: 130px;"/>
                            </li>
                            <li>
                                <label>物料：</label>
                                <input type="text" name="MATNR" style="width: 130px;"/>
                            </li>
                            <li>
                                <label>物料描述：</label>
                                <input type="text" name="MAKTX" style="width: 130px;"/>
                            </li>

                            <li>
                                <label>库存地点：</label>
                                <input type="text" name="LGORT" style="width: 130px;"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
<!--                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:DN:add">-->
<!--                    <i class="fa fa-plus"></i> 添加-->
<!--                </a>-->
<!--                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:DN:edit">-->
<!--                    <i class="fa fa-edit"></i> 修改-->
<!--                </a>-->
<!--                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:DN:remove">-->
<!--                    <i class="fa fa-remove"></i> 删除-->
<!--                </a>-->
                <a class="btn btn-warning" onclick="$.table.exportExcel()">
                    <i class="fa fa-download"></i> 导出
                </a>
                <a class="btn btn-info" onclick="getInstock()">
                    <i class="fa fa-upload"></i> 手动获取单据
                </a>
            </div>
            <div id="div"  class="col-sm-12 select-table table-striped">
                <table  id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:DN:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:DN:remove')}]];
        var prefix = ctx + "system/DN";

        function getInstock() {
            var vbeln = document.getElementById("VBELN").value;
            $.ajax({
                "url": "/timer/getInOrOutOrderOne?VBELN="+vbeln,
                "type": "GET",
                "dataType": "json",
                "success": function (result) {
                    $.modal.alert(result.msg)
                }
            });

        }

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                height: $("#div").height() / 1,
                modalName: "内外向交货单原始数据",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'vbeln',
                    title: '交货'
                },
                {
                    field: 'kunnr',
                    title: '送达方'
                },
                {
                    field: 'kunag',
                    title: '售达方'
                },
                {
                    field: 'lifnr',
                    title: '供应商'
                },
                {
                    field: 'posnr',
                    title: '交货项目'
                },
                {
                    field: 'matnr',
                    title: '物料'
                },
                {
                    field: 'lfimg',
                    title: '交货数量'
                },
                {
                    field: 'maktx',
                    title: '物料描述'
                },
                {
                    field: 'werks',
                    title: '工厂'
                },
                {
                    field: 'lgort',
                    title: '库存地点'
                },
                {
                    field: 'sobkz',
                    title: '特殊库存标志'
                },
                {
                    field: 'vrkme',
                    title: '单位'
                },
                {
                    field: 'vgbel',
                    title: '销售订单号'
                },
                {
                    field: 'vgpos',
                    title: '销售订单行号'
                },
                // {
                //     title: '操作',
                //     align: 'center',
                //     formatter: function(value, row, index) {
                //         var actions = [];
                //         actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.VBELN + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                //         actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.VBELN + '\')"><i class="fa fa-remove"></i>删除</a>');
                //         return actions.join('');
                //     }
                // }
                ]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>